const prompt = require("@/components/common/prompt/prompt")
const axios = require('axios')
const qs = require('qs')
module.exports = {
  zc(posts) {
    axios
      .post("http://127.0.0.1/get", posts, qs.stringify())
      .then((res) => {
        if (res.data == "400") {
          prompt.ts(".zc", "账号已存在,不需要注册");
        } else {
          prompt.su(".zc", "注册成功");
        }
        console.log(res);
      }).catch((e) => { });
  },
  dr(posts) {
    axios.post("http://127.0.0.1/admindr", posts, qs.stringify())
      .then((res) => {
        if (res.data.data[0].user) {
          prompt.su(".dr", "...正在登录");
          // setTimeout(() => {
          //   location.href = "home";
          // }, 2000);
          console.log(res.data);
        } else {
          prompt.ts(".dr", "账号或密码不存在");
        }
      }).catch((e) => { });
  }
}

